#include <iostream>
/*
    全局函数做友元
*/

class Home
{

    friend void visit_home(Home *home);

private:
    std::string bed_room = "卧室";

public:
    std::string living_room = "客厅";
};

void visit_home(Home *home)
{
    std::cout << home->living_room << std::endl;
    std::cout << home->bed_room << std::endl; // 全局友元函数可以访问私有属性；不加friend 友元函数关键字就会报错了
}

int main(int argc, char const *argv[])
{
    Home home;

    visit_home(&home);
    return 0;
}
